﻿<div ng-repeat="element in source.children">
    <div class="dynamic-expression_t">
        <ng-include src='element.templateURL'></ng-include>
    </div>
    <div class="dynamic-expression_b">
        <span class="error" ng-if="element.getValidationError()">{{element.getValidationError()}}</span>
        <ul class="list" ng-if="element.children && element.children.length">
            <li class="list-item" ng-repeat="element1 in element.children">
                <a class="list-link">
                    <i class="list-ico fa fa-times-circle" ng-click='deleteChild(element1, element.children);'></i>
                    <ng-include src='element1.templateURL'></ng-include>
                    <ul class="list __sub" ng-if="element1.newChildLabel">
                        <li class="list-item" ng-repeat="element in element1.children">
                            <i class="list-ico fa fa-times-circle" ng-click='deleteChild(element, element1.children);'></i>
                            <ng-include src='element.templateURL'></ng-include>
                        </li>
                        <li class="list-item">
                            <a href="#" class="add" left-click-menu data-target="deb_menu1_{{$index}}">{{element1.newChildLabel}}</a>
                            <ul class="menu __context" role="menu" id="deb_menu1_{{$index}}">
                                <li class="menu-item" ng-click='addChild(child, element1);' ng-repeat="child in element1.availableChildren">{{child.displayName}}</li>
                            </ul>
                        </li>
                    </ul>
                </a>
            </li>
        </ul>
        <a class="add __link __usergroup" left-click-menu data-target="det_add_{{element.id}}">{{element.newChildLabel}}</a>
        <ul class="menu __context" role="menu" id="det_add_{{element.id}}">
            <li class="menu-item" ng-class="{'__right': child.subitems}" ng-click='!child.subitems && addChild(child, element)' ng-repeat="child in element.availableChildren">
                <i class="menu-ico fa fa-caret-right" ng-if="child.subitems"></i>{{child.displayName}}
                <ul class="menu __sub" ng-if="child.subitems">
                    <li class="menu-item" ng-click='addChild(child, element)' ng-repeat="child in child.subitems">{{child.displayName}}</li>
                </ul>
            </li>
        </ul>
    </div>
</div>